<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<!-- si passano tre parametri:                 -->
<!-- tipo:   il tipo di record;                -->
<!-- id  :   il codice del record;             -->
<!-- home:   la pagina a cui si deve ritornare -->
<%@page import="utility.connections" %>
<%! String strType,record,location,home;%>
<% 
	String tipo=request.getParameter("tipo").toString().toLowerCase();
	String id  =request.getParameter("id").toString().toUpperCase();
	       home=request.getParameter("home").toString().toLowerCase();
	String qry="";
	ResultSet rs;
	       
	if(tipo.equalsIgnoreCase("dipendente"))
	{
		strType=" dipendente";
		location="delete_dipendente";
		qry="select * from personale where matricola = " + id;
		session.setAttribute("del_dipendente",id);
		rs=connections.getStatement().executeQuery(qry);
		if(rs.next())
		{
			record="\nmatricola:"+rs.getString("matricola")
			      +"\ncod. fisc.:"+rs.getString("codicefiscale")
			      +"\nnome:"+rs.getString("nome")
			      +"\ncognome:"+rs.getString("cognome");
			rs.close();
			
		}
	}
	else if(tipo.equalsIgnoreCase("bene"))
	{
		record="DIPENDENTE CON MATRICOLA :" + id;
		location="delete_dipendente";
	}
	else if(tipo.equalsIgnoreCase("categoria"))
	{
		record="DIPENDENTE CON MATRICOLA :" + id;
		location="delete_dipendente";
	}
	else if(tipo.equalsIgnoreCase("sottocategoria"))
	{
		record="DIPENDENTE CON MATRICOLA :" + id;
		location="delete_dipendente";
	}
	else if(tipo.equalsIgnoreCase("fornitore"))
	{
		record="DIPENDENTE CON MATRICOLA :" + id;
		location="delete_dipendente";
	}
	else if(tipo.equalsIgnoreCase("gruppo"))
	{
		record="DIPENDENTE CON MATRICOLA :" + id;
		location="delete_dipendente";
	}
	else
	{
		record="ERRORE DURANTE LA LETTURA DEI DATI ";
		location=home;
	}
%>
		   
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>ERRORE</title>
<style type="text/css">
<!--
.style1 {font-family: Verdana, Calibri, Cambria}
.style3 {font-family: Verdana, Calibri, Cambria; font-size: small; }
.style4 {
	font-family: Verdana, Calibri, Cambria;
	font-weight: bold;
	font-style: italic;
	color: #FFFFFF;
}
body {
	background-color: #FFFF99;
}
-->
</style>
</head>

<body>
<table width="700" height="422" border="0" align="center">
  <tr>
    <td align="center" valign="middle"><img src="images/title.png" width="700" height="100"></td>
  </tr>
  <tr>
    <td height="257" align="center" valign="top"><table width="100%" border="0">
      <tr>
        <td align="center"><div align="left">
          <p class="style3">
		  </p>
        </div></td>
        </tr>
      <tr>
        <td class="style1"><p align="center"><strong>ATTENZIONE</strong></p>
          <p align="center"><strong>si &egrave; scelto di eliminare il seguente <%=strType%>:</strong></p>
          <p align="center"><%=record%></p></td>
        </tr>
      <tr>
        <td class="style1"><div align="center">
          <p>&nbsp;</p>
          </div></td>
        </tr>
      <tr>
        <td class="style1"><div align="center">
		<input type="submit" name="btnreturn" style="width:150px;" value="CONFERMA" onClick="location.href='<%=location%>'" />
		<input type="submit" name="btnreturn2" style="width:150px;" value="INDIETRO" onClick="location.href='<%=home%>'" />
        </div></td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td align="center" valign="middle">&nbsp;</td>
  </tr>
  <tr>
    <td align="center" valign="middle" bgcolor="#000099"><div align="right" class="style4">CONFERMA RICHIESTA </div></td>
  </tr>
</table>
</body>
</html>
